const io = new IntersectionObserver(
  (entries) => {
    entries.forEach((entries) => {
      // 出现在视口
      if (entries.isIntersecting) {
        store.commit('video/GET_VIDEO', { refId: props.id, parentIndex: props.xIndex, flag: false })
        // if (store.state.video.indexList[0] == props.xIndex) {
        //   initPlayer(entries.target.id)
        // }
        console.log(store.state.video.indexList, props.xIndex, '进入了')
        // console.log('出现在视口', entries)
        entries.target.ckFlag = true

        // 消失在视口
      } else {
        store.commit('video/DELETE_VIDEO', { refId: props.id, parentIndex: props.xIndex })
        // console.log('消失在视口', store.state.video.indexList)
        // if(entries.target.id == store)
        console.log(store.state.video.indexList, props.xIndex, '消失了')
        if (entries.target.children[0]) {
          entries.target.children[0].remove()
        }
      }
    })
  },
  { threshold: [1] }
)
